package com.lp.user.control;

import com.lp.common.base.BaseController;
import io.swagger.annotations.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/redis")
public class RedisController extends BaseController {


    @ApiOperation(value="sting获取key值", notes="sting获取key值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "key", value = "key的名称", required = true, dataType = "string",paramType="query" ),
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "返回key的结果"),

    })
    @RequestMapping(value = "/get", method = RequestMethod.GET)
    String home(String key) {
        logger.debug(key);
        return redisClientTemplate.get(key);
    }
    @RequestMapping(value = "/set", method = RequestMethod.GET)
    @ApiOperation(value="sting设key值", notes="sting设key值")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "key", value = "key的名称", required = true, dataType = "string",paramType="query" ),
            @ApiImplicitParam(name = "value", value = "要设的值", required = true, dataType = "string",paramType="query" ),
    })
    @ApiResponses({
            @ApiResponse(code=200,message = "返回结果"),

    })
    String set(String key,String value) {

        return redisClientTemplate.set(key,value);
    }

 
}